import axios from 'axios';

//账号密码登录
export const Account = params => {
    return axios.post(`/api/login/sign-in-with-account`,
        params
    );
};
//总院概览
export const ofheadquarters = (params, a) => {
    return axios.post(`/api/man/centre-overview`,
        params, {
            headers: {
                "token": a
            }
        });
};
//总院订单列表详情
export const ordeist = (params, a) => {
    return axios.post(`/api/man/order-list`,
        params, {
            headers: {
                "token": a
            }
        });
};

//总院订单列表
export const branchList = (params, a) => {
    return axios.post(`/api/man/branch-list`,
        params, {
            headers: {
                "token": a
            }
        });
};
//总院分院详情
export const branch = (params, a) => {
    return axios.post(`/api/man/branch-overview`,
        params, {
            headers: {
                "token": a
            }
        });
};

export const colResult = (params, a) => {
    return axios.post(`/api/column/columnResult`,
        params, {
            headers: {
                "token": a
            }
        });
};


//分院首页数据
export const Branch = (params, a) => {
    return axios.post(`/api/man/branch-overview`,
        params, {
            headers: {
                "token": a,
            }
        }
    );
};
//业务员列表
export const Salesmanlist = (params, a) => {
        return axios.post(`/api/man/salesman-list`,
            params, {
                headers: {
                    "token": a,
                }
            }
        )
    }
    //分院业务员购课列表
export const Course = (params, a) => {
        return axios.post(`/api/man/salesman-detail-course`,
            params, {
                headers: {
                    "token": a,
                }
            }
        )
    }
    //分院业务员详情
export const Salesmandetail = (params, a) => {
        return axios.post(`/api/man/salesman-detail`,
            params, {
                headers: {
                    "token": a,
                }
            }
        )
    }
    //订单明细
export const Detailorder = (params, a) => {
        return axios.post(`/api/order/order-detail`,
            params, {
                headers: {
                    "token": a,
                }
            }
        )
    }
    //分院我的
export const branchOwner = (params, a) => {
        return axios.post(`/api/man/branch-owner`,
            params, {
                headers: {
                    "token": a,
                }
            }
        )
    }
    //分院订单列表
export const branchorder = (params, a) => {
        return axios.post(`/api/man/branch-order-list`,
            params, {
                headers: {
                    "token": a,
                }
            }
        )
    }
    //设置抽成比例
export const viewBranchRate = (params, a) => {
        return axios.post(`/api/man/view-branch-rate`,
            params, {
                headers: {
                    "token": a,
                }
            }
        )
    }
    //修改分院比例
export const editBranchRate = (params, a) => {
        return axios.post(`/api/man/edit-branch-rate`,
            params, {
                headers: {
                    "token": a,
                }
            }
        )
    }
    //专栏列表
export const columnResult = (params, a) => {
    return axios.post(`/api/column/columnResult`,
        params, {
            headers: {
                "token": a
            }
        }
    )
}

//更多专栏
export const columnList = (params, a) => {
        return axios.post(`/api/column/columnList`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //银行卡列表
export const queryBank = (params, a) => {
        return axios.post(`/api/bank/queryBank`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //添加银行
export const Insert = (params, a) => {
        return axios.post(`/api/bank/insert`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //确认提现
export const cashOut = (params, a) => {
        return axios.post(`/api/bank/cashOut`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //提现微信
export const Cash = (params, a) => {
        return axios.post(`/api/cash-out/cash`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //会员卡列表
export const cardList = (params, a) => {
        return axios.post(`/api/sales/card-list`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //会员卡详情
export const cardDetail = (params, a) => {
        return axios.post(`/api/sales/card-detail`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    // export const wxLogin = (appid) => {
    //   return axios.get(`https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxc74ae6a677c8b11d&secret=761c114897dcbd488da5e265544b6d96`)
    // }

//微信登录
//  function getUrlparam(params) {
//   let reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
//   let r = redirect_uri.search.substr(1).match(reg);  //匹配目标参数
//   if (r!=null){
// return unescape(r[2])
// }
// return null; //返回参数值
// }
export const wxLogin = () => {

    // if(code){
    //     return axios.post(`/api/login/sign-in-with-code-h5`,
    //     code,{
    //       headers: {
    //         "token": a
    //       }
    //     }
    //   )
    // }
    // const code = Common.getUrlparam('coed')



    let redirect_uri = encodeURIComponent("https://xcy.shuidongjia.net/#/")
        // ① 这是appid
    const appid = "wxc74ae6a677c8b11d"
    return window.location.href = (`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`)
}
export const wxLoginone = () => {
        // if(code){
        //     return axios.post(`/api/login/sign-in-with-code-h5`,
        //     code,{
        //       headers: {
        //         "token": a
        //       }
        //     }
        //   )
        // }
        // const code = Common.getUrlparam('coed')
        let redirect_uri = encodeURIComponent("https://xcy.shuidongjia.net/#/Salesman/catalog")
            // ① 这是appid
        const appid = "wxc74ae6a677c8b11d"
        return window.location.href = (`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`)
    }
    //code 传输
export const codeData = (data, a) => {
        return axios.post(`/api/login/sign-in-with-code-h5`, data)
    }
    //线下code传输
export const codeData1 = (data, a) => {
        return axios.post(`/api/login/sign-in-with-code-h5-enroll`, data)
    }
    //专栏詳情
export const columnDetail = (params, a) => {
        return axios.post(`/api/column/columnDetail`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //业务员我的
export const owner = (params, a) => {
        return axios.post(`/api/sales/owner`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //业务员购课列表
export const ownercourse = (params, a) => {
        return axios.post(`/api/sales/owner-course`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //支付
export const Reqpay = (params, a) => {
        return axios.post(`/api/pay/req-pay`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //sdk
export const Sdksig = (params, a) => {
        return axios.post(`/api/pay/js-sdk-signature`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //sdk
export const codeh5 = (params, a) => {
        return axios.post(`/api/login/sign-in-with-code-h5-share`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //POST /enroll/check-phone验证手机用户名--公众号端
export const checkPhone = (params, a) => {
        return axios.post(`/api/enroll/check-phone`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //POST /sms/sender发送验证码
export const sender = (params, a) => {
        return axios.post(`/api/sms/sender`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //POST /pay/course-req-pay线下课程请求下单支付
export const coursereqPay = (params, a) => {
        return axios.post(`/api/pay/course-req-pay`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //首页课程
export const getCourse = (params, a) => {
        return axios.post(`/api/enroll/get-course`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //课程图片
export const getCourseNop = (params, a) => {
        return axios.post(`/api/enroll/get-course-none-power`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //上传文件
export const Fileupload = (params, a) => {
        return axios.post(`/api/file/file-upload`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //获取发票
export const getInvoice = (params, a) => {
        return axios.post(`/api/enroll/get-invoice`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //上传文件
export const Committransfer = (params, a) => {
        return axios.post(`/api/enroll/commit-transfer`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //提交发票信息
export const commitInvoice = (params, a) => {
        return axios.post(`/api/enroll/commit-invoice`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //提现状态
export const Cashlist = (params, a) => {
        return axios.post(`/api/cash-out/cash-list`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //新版首页
export const Columnindex = (params, a) => {
        return axios.post(`/api/column/index`,
            params, {
                headers: {
                    "token": a
                }
            }
        )
    }
    //大专栏详情
export const Bigdetail = (params, a) => {
    return axios.post(`/api/column/big-detail`,
        params, {
            headers: {
                "token": a
            }
        }
    )
}